#include "junix.h"
#include <boost/math/common_factor.hpp>

int main(int argc, char **argv)
{
	if(argc != 3)
	{
		std::cout<<"Usage:"<<argv[0]<<" num1 num2"<<std::endl;
		exit(EXIT_FAILURE);
	}

	int num1,num2;

	try{
		num1 = boost::lexical_cast<int>(argv[1]);
		num2 = boost::lexical_cast<int>(argv[2]);
	}catch(...){
		std::cerr<<"bad cast"<<std::endl;
		exit(EXIT_FAILURE);
	}

	std::cout<<boost::math::gcd(num1, num2)<<std::endl;
	return 0;
}
